package com.jswl.training.springjpa.common.state;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result {
    private  boolean success;
    private  int code=200;
    private String msg;
    private Object data;

    public static Result ok(Object data){
        return new Result(true,200,"",data);
    }


    public static Result error(int code,String msg){
        return new Result(false,code,msg,null);
    }

    public static Result error(String msg){
        return new Result(false,9999,msg,null);
    }
}
